﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Data;

namespace Sobiens.WPF.Controls.UserControls
{
    /// <summary>
    /// Interaction logic for LanguagesDropDown.xaml
    /// </summary>
    public partial class LanguagesDropDown : UserControl
    {
        public LanguagesDropDown()
        {
            InitializeComponent();
            Languages = GetData();
        }
        public DataTable Languages
        {
            get { return (DataTable)GetValue(LanguagesProperty); }
            set { SetValue(LanguagesProperty, value); }
        }

        public static readonly DependencyProperty LanguagesProperty = DependencyProperty.Register("Languages", typeof(DataTable), typeof(LanguagesDropDown), new UIPropertyMetadata(null));

        public String SelectedLanguage
        {
            get { return (String)GetValue(SelectedLanguageProperty); }
            set { SetValue(SelectedLanguageProperty, value); }
        }

        public static readonly DependencyProperty SelectedLanguageProperty = DependencyProperty.Register("SelectedLanguage", typeof(String), typeof(LanguagesDropDown), new UIPropertyMetadata(null));

        public DataTable GetData()
        {
            DataTable dt = new DataTable("language");

            DataSet ds = new DataSet();
            dt.Columns.Add("code");
            dt.Columns.Add("value");

            DataRow row1 = dt.NewRow();
            row1["code"] = "en-GB";
            row1["value"] = "English UK";
            dt.Rows.Add(row1);

            DataRow row2 = dt.NewRow();
            row2["code"] = "fr-FR";
            row2["value"] = "French";
            dt.Rows.Add(row2);

            DataRow row3 = dt.NewRow();
            row3["code"] = "de-DE";
            row3["value"] = "German";
            dt.Rows.Add(row3);

            DataRow row4 = dt.NewRow();
            row4["code"] = "ru-RU";
            row4["value"] = "Russian";
            dt.Rows.Add(row4);

            ds.Tables.Add(dt);
            return ds.Tables[0];
        }
    }
}
